home *** CD-ROM | disk | FTP | other *** search
- Path: ub239.dialup.uwa.edu.au!not-for-mail
- From: prye@cyllene.uwa.edu.au (Peter Rye)
- Newsgroups: comp.lang.c++
- Subject: Re: cout stupidity
- Date: 13 Jan 1996 01:21:25 +0800
- Organization: The University of Western Australia
- Message-ID: <4d65al$1oj@ub239.dialup.uwa.edu.au>
- References: <4d321g$eal@calvin.st-and.ac.uk>
- NNTP-Posting-Host: ub239.dialup.uwa.edu.au
-
- ks2@st-and.ac.uk (Keith Sibson) writes:
-
-
- >#include <iostream.h>
-
- >int count=10;
-
- >main()
- >{
- > for(i=0;i<cout;i++) {.....}
- > return(0);
- >}
-
- >Why does this stupidity compile? (BCC 4.5)
-
- >Surely cout is of type ostream? Either there is a dubious operator< that
- >takes an int and ostream, or there is some wacky automatic conversions going
- >on. Does an ostream cast to an int that is the stream position?
-
- >Keith.
-
- Hi Keith,
- Won't compile here....
-
- Linux ub239 1.2.1 #6 Mon Nov 6 21:14:54 WST 1995 i486
- gcc version 2.6.3
-
- g++ -c test.cpp
- ~/test.cpp: In function `int main()':
- ~/test.cpp:7: no match for `operator <(int, class _IO_ostream_withassign)'
- --
- | Peter Rye |
- | Respiratory Research Fellow |
- | Princess Margaret Hospital for Children |
- | Perth, Western Australia |
-